﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Username
    {
        public string name { get; set; }
        public string sex { get; set; }
        public int num { get; set; }
        public string  zhuangye { get; set; }
        private int age;
        public int Age 
        {
            get { return this.age; }
            set {
                if (value<=0||value>=128)
                {
                    value = 0;
                }
                
                
                this.age = value; }
        
        }

        public Username(string name, string sex, int num, string zhuangye, int age)
        {
            this.name = name;
            this.sex = sex;
            this.num = num;
            this.zhuangye = zhuangye;
            Age = age;
           
        }
        public Username() 
        {
            this.zhuangye = "本科";
        }
      
        public void Hello()
        {
            Console.WriteLine($"姓名为{name}性别为{sex}学号{num}学历{this.zhuangye}年龄{this.Age}");
        
        }
    }
}
